shapiro.test(resid(Final_St_model))
# load data
Ghanam_data <- read.csv(choose.files()) # Choose file 'Ghanam_scaled_kinematics_data.csv'
names(Ghanam_data)
# specify factors
Ghanam_data$TemperatureF <- as.factor(Ghanam_data$Temperature)
Ghanam_data$AreaF <- as.factor(Ghanam_data$Area)
Ghanam_data$BLsF <- as.factor(Ghanam_data$BLs)
# BEST MODEL SELECTION:
Final_St_model <- lmer(data = Ghanam_data, (St) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
Final_St_model1 <- lmer(data = Ghanam_data, (St) ~ BLs * TemperatureF * AreaF + (1 | ID:AreaF:TemperatureF))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
anova(Final_St_model,Final_St_model1)
# Check for assumptions:
shapiro.test(resid(Final_St_model))
leveneTest(St~ interaction(TemperatureF,AreaF,BLsF), Ghanam_data)
grubbs.test(Ghanam_data$St)
# remove outlier and retest assumptions
St1 <- subset(Ghanam_data, Ghanam_data$St != '0.69495213')
grubbs.test(St1$St)
# data:  St1$St
# G = 3.58534, U = 0.91487, p-value = 0.01935
# alternative hypothesis: highest value 0.583341318 is an outlier
St2 <- subset(St1, St1$St != '0.583341318')
grubbs.test(St2$St)
Final_St_model <- lmer(data = St1, (St^0.51) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
St1
Final_St_model <- lmer(data = St1, (St^3) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
Final_St_model <- lmer(data = St1, transformTukey(St) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
Final_St_model <- lmer(data = St2, transformTukey(St) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
Final_St_model <- lmer(data = St2, (St^-0.51) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
Final_St_model <- lmer(data = St2, (St^0.51) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
Final_St_model <- lmer(data = St2, (St^1.51) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
Final_St_model <- lmer(data = St2, (St^2.51) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
Final_St_model <- lmer(data = St2, (St^0.0051) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
# load data
Ghanam_data <- read.csv(choose.files()) # Choose file 'Ghanam_scaled_kinematics_data.csv'
names(Ghanam_data)
# Focus on data >1.7 bls
Ghanam_data_trim1 <- subset(Ghanam_data, Ghanam_data$BLs > 1.1)
table(Ghanam_data_trim1$BLsF)
# load data
Lehren_data <- read.csv(choose.files()) # Choose file 'Lehren_scaled_kinematics_data.csv'
names (Lehren_data)
# specify factors and table
Lehren_data$BLsF <- as.factor(Lehren_data$BLs)
table(Lehren_data$BLsF)
# Focus on data >1.7 bls
Ghanam_data$BLsF <- as.factor(Ghanam_data$BLs)
Ghanam_data_trim1 <- subset(Ghanam_data, Ghanam_data$BLs > 1.1)
table(Ghanam_data_trim1$BLsF)
# specify remaining factors
Ghanam_data$TemperatureF <- as.factor(Ghanam_data$Temperature)
Ghanam_data$AreaF <- as.factor(Ghanam_data$Area)
AMPLITUDE
# BEST MODEL SELECTION
Final_Amp_model <- lmer(data = Ghanam_data, transformTukey(Scaled_Amp) ~ TemperatureF * AreaF * BLs + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
Final_Amp_model1 <- lmer(data = Ghanam_data, transformTukey(Scaled_Amp) ~ TemperatureF * AreaF * BLs + (1 | ID:AreaF:TemperatureF))
anova(Final_Amp_model,Final_Amp_model1)
# Check for assumptions:
shapiro.test(resid(Final_Amp_model))
# write trimmed dataset to file and reload trimmed data
write.csv(Ghanam_data_trim1, "Ghanam_data_trim1.csv")
Ghanam_data <- read.csv("Ghanam_data_trim1.csv")
# specify remaining factors
Ghanam_data$TemperatureF <- as.factor(Ghanam_data$Temperature)
Ghanam_data$AreaF <- as.factor(Ghanam_data$Area)
AMPLITUDE
# BEST MODEL SELECTION
Final_Amp_model <- lmer(data = Ghanam_data, transformTukey(Scaled_Amp) ~ TemperatureF * AreaF * BLs + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
Final_Amp_model1 <- lmer(data = Ghanam_data, transformTukey(Scaled_Amp) ~ TemperatureF * AreaF * BLs + (1 | ID:AreaF:TemperatureF))
anova(Final_Amp_model,Final_Amp_model1)
# Check for assumptions:
shapiro.test(resid(Final_Amp_model))
# Check for assumptions:
shapiro.test(resid(Final_Amp_model))
# Shapiro-Wilk normality test
# data:  resid(Final_Amp_model)
# W = 0.98432, p-value = 0.09311
leveneTest(transformTukey(Scaled_Amp) ~ interaction(Temperature, Area, BLs), data = Ghanam_data)
# Levene's Test for Homogeneity of Variance (center = median)
# group  39  0.7617 0.8319
# 107
grubbs.test(Ghanam_data$Scaled_Amp)
r.squaredGLMM(Final_Amp_model)
r2beta(Final_Amp_model, method = "nsj")
epsilon_squared(Final_Amp_model)
anova(Final_Amp_model)
summary(Final_Amp_model)
# SLOPES MODEL:
ls_trend <- lstrends(Final_Amp_model, ~ TemperatureF * AreaF, var = "BLs")
# run model:
summary(ls_trend, infer=TRUE)
# run pairwise comparison to check for differences among AG and GO fishes
pairs(ls_trend, adjust = 'fdr')
# Pooled model **not included in manuscript**
Final_Amp_model1 <- lmer(data = Ghanam_data, transformTukey(Scaled_Amp) ~ TemperatureF * BLs + (1 | ID))
# Check for pooled model assumptions:
shapiro.test(resid(Final_Amp_model1))
#	Shapiro-Wilk normality test
# data:  resid(Final_Amp_model1)
# W = 0.98311, p-value = 0.06808
leveneTest(transformTukey(Scaled_Amp) ~ interaction(Temperature, BLs), data = Ghanam_data)
#Pooled model fit:
r.squaredGLMM(Final_Amp_model1)
# Run pooled model
anova(Final_Amp_model1)
# Pooled slopes model
ls_trend1 <- lstrends(Final_Amp_model1, ~ TemperatureF, var = "BLs")
# Run pooled slopes model
summary(ls_trend1, infer=TRUE)
pairs(ls_trend1, adjust = 'fdr')
# BEST MODEL SELECTION:
Final_Hz_model <- lmer(data = Ghanam_data, (Scaled_Hz) ~ TemperatureF * AreaF * BLs + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
Final_Hz_model1 <- lmer(data = Ghanam_data, (Scaled_Hz) ~ TemperatureF * AreaF * BLs + (1 | ID:AreaF:TemperatureF))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
anova(Final_Hz_model,Final_Hz_model1)
# Check for assumptions:
shapiro.test(resid(Final_Hz_model))
leveneTest((Scaled_Hz)~ interaction(TemperatureF,AreaF,BLsF), Ghanam_data)
# Levene's Test for Homogeneity of Variance (center = median)
# Df F value Pr(>F)
# group  39  0.9204 0.6061
# 107
grubbs.test(Ghanam_data$Scaled_Hz)
r.squaredGLMM(Final_Hz_model)
r2beta(Final_Hz_model, method = "nsj")
epsilon_squared(Final_Hz_model)
# Run model:
anova(Final_Hz_model)
summary(Final_Hz_model)
# Slopes model
ls_trend <- lstrends(Final_Hz_model, ~ TemperatureF * AreaF, var = "BLs")
# Run slopes model:
summary(ls_trend, infer=TRUE)
pairs(ls_trend, adjust = 'none')
# Pooled model
Final_Hz_model1 <- lmer(data = Ghanam_data, (Scaled_Hz) ~ TemperatureF * BLs + (1 | ID))
# Check for pooled model assumptions:
shapiro.test(resid(Final_Hz_model1))
leveneTest(Scaled_Hz~ interaction(TemperatureF,BLsF), Ghanam_data)
# Pooled model fit:
r.squaredGLMM(Final_Hz_model1)
# Run pooled model
anova(Final_Hz_model1)
# Pooled slopes model
ls_trend1 <- lstrends(Final_Hz_model1, ~ TemperatureF, var = "BLs")
# Run pooled slopes model
summary(ls_trend1, infer=TRUE)
pairs(ls_trend1, adjust = 'none')
# BEST MODEL SELECTION:
Final_St_model <- lmer(data = Ghanam_data, (St) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
Final_St_model1 <- lmer(data = Ghanam_data, (St) ~ BLs * TemperatureF * AreaF + (1 | ID:AreaF:TemperatureF))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
anova(Final_St_model,Final_St_model1)
# Check for assumptions:
shapiro.test(resid(Final_St_model))
leveneTest(St~ interaction(TemperatureF,AreaF,BLsF), Ghanam_data)
grubbs.test(Ghanam_data$St)
# remove outlier and retest assumptions
St1 <- subset(Ghanam_data, Ghanam_data$St != '0.583341318')
grubbs.test(St1$St)
Final_St_model <- lmer(data = St1, (St) ~ BLs * TemperatureF * AreaF + (1 | ID))
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
shapiro.test(resid(Final_St_model))
#	Shapiro-Wilk normality test
# data:  resid(Final_St_model)
# W = 0.98394, p-value = 0.08651
leveneTest(St~ interaction(TemperatureF,AreaF,BLsF), St1)
# Model fit:
r.squaredGLMM(Final_St_model)
r2beta(Final_St_model, method = "nsj")
epsilon_squared(Final_St_model)
# Run model:
anova(Final_St_model)
summary(Final_St_model)
# Slopes model
ls_trend <- lstrends(Final_St_model, ~ TemperatureF * AreaF, var = "BLs")
# Run slopes model:
summary(ls_trend, infer=TRUE)
pairs(ls_trend, adjust = 'fdr')
# Pooled model
Final_St_model1 <- lmer(data = St, (Value) ~ TemperatureF * BLs + (1 | ID))
# Pooled model
Final_St_model1 <- lmer(data = St1, (St) ~ TemperatureF * BLs + (1 | ID))
# Check for pooled model assumptions:
shapiro.test(resid(Final_St_model1))
leveneTest(Value~ interaction(TemperatureF,BLsF), St)
leveneTest(St~ interaction(TemperatureF,BLsF), St1)
# Pooled model fit:
r.squaredGLMM(Final_St_model1)
# Run pooled model
anova(Final_St_model1)
# Pooled slopes model
ls_trend1 <- lstrends(Final_St_model1, ~ TemperatureF, var = "BLs")
# Run pooled slopes model
summary(ls_trend1, infer=TRUE)
pairs(ls_trend1, adjust = 'fdr')
#RAW AS mass scalng
# load data and set factors
DTA <- read.csv(choose.files()) # use file 'slope stats Ghanam div -Nov2023.csv'
gtemp5 <- factor(DTA$gtemp)
gpop5 <- factor(DTA$gpop)
# BEST MODEL SELECTION
JJ1 <-lmer(gvalue ~ gtemp5*gpop5*gmass + (1|gtemp5/gpop5), na.action=na.exclude, DTA)
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
# Warning messages:
# 1: Model failed to converge with 1 negative eigenvalue: -3.3e-08
# 2: In as_lmerModLT(model, devfun) :
# transform data to deal with warning
JJ1 <-lmer(gvalue^3 ~ gtemp5*gpop5*gmass + (1|gtemp5/gpop5), na.action=na.exclude, DTA)
JJ2 <-lmer(gvalue^3 ~ gtemp5*gpop5*gmass + (1|gpop5), na.action=na.exclude, DTA)
# test best model using anova
anova(JJ1,JJ2)
# Check for assumptions:
shapiro.test(resid(JJ1))
leveneTest(gvalue^3 ~ interaction(gpop5,gtemp5), DTA)
grubbs.test(DTA$gvalue^3)
r.squaredGLMM(JJ1)
epsilon_squared(JJ1)
r2beta(JJ1, method = "nsj")
anova(JJ1)
# Slopes model
JL1 <- lstrends(JJ1, ~ gtemp5*gpop5, var="gmass")
# Run slopes model:
summary(JL1, infer=TRUE)
pairs(JL1 , adjust=c("fdr"))
# Pooled model
JJ3 <-lmer(gvalue^3 ~ gtemp5*gmass + (1|gtemp5/gpop5), na.action=na.exclude, DTA)
# Check for pooled model assumptions:
shapiro.test(resid(JJ3))
leveneTest(gvalue^3 ~ gtemp5, DTA)
# Pooled model fit:
r.squaredGLMM(JJ3)
# Run pooled model
anova(JJ3)
# Pooled slopes model
JL4 <- lstrends(JJ3, ~ gtemp5, var="gmass")
# Run pooled slopes model
summary(JL4, infer=TRUE)
pairs(JL4 , adjust=c("fdr"))
# BEST MODEL SELECTION
gtemp6 <- factor(DTA$gtemp1)
gpop6 <- factor(DTA$gpop1)
JU1 <-lmer(gvalue1 ~ gtemp6*gpop6*gmass1 + (1|gtemp6/gpop6), na.action=na.exclude, DTA)
JU2 <-lmer(gvalue1 ~ gtemp6*gpop6*gmass1 + (1|gpop6), na.action=na.exclude, DTA)
# check best model using anova
anova(JU1,JU2)
# Check for assumptions:
shapiro.test(resid(JU1))
leveneTest(gvalue1 ~ interaction(gpop6,gtemp6), DTA)
grubbs.test(DTA$gvalue1)
# Model fit:
r.squaredGLMM(JU1)
r2beta(JU1, method = "nsj")
epsilon_squared(JU1)
# Run model:
anova(JU1)
# Slopes model
JUL1 <- lstrends(JU1, ~ gtemp6*gpop6, var="gmass1")
# Run slopes model:
summary(JUL1, infer=TRUE)
pairs(JUL1 , adjust=c("fdr"))
# Pooled model
JJ4 <-lmer(gvalue1 ~ gtemp6*gmass1 + (1|gtemp6/gpop6), na.action=na.exclude, DTA)
JJ4 <-lmer(gvalue1^2 ~ gtemp6*gmass1 + (1|gtemp6/gpop6), na.action=na.exclude, DTA)
# Check for pooled model assumptions:
shapiro.test(resid(JJ4))
leveneTest(gvalue1^1.3 ~ gtemp6, DTA)
# Pooled model fit:
r.squaredGLMM(JJ4)
# Run pooled model
anova(JJ4)
# Pooled slopes model
JL4 <- lstrends(JJ4, ~ gtemp6, var="gmass1")
# Run pooled slopes model
summary(JL4, infer=TRUE)
pairs(JL4 , adjust=(('fdr')))
# Factors
Gpop2 <- factor(DTA$gpop2)
Gtemp2 <- factor(DTA$gtemp2)
# BEST MODEL SELECTION
Jsmr1 <-lmer(gvalue2 ~ Gtemp2*Gpop2*gmass2 + (1|Gtemp2/Gpop2), na.action=na.exclude, DTA)
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
Jsmr2 <-lmer(gvalue2 ~ Gtemp2*Gpop2*gmass2 + (1|Gpop2), na.action=na.exclude, DTA)
anova(Jsmr1,Jsmr2)
# Check for assumptions:
shapiro.test(resid(Jsmr1))
leveneTest(gvalue2 ~ interaction(Gpop2,Gtemp2), DTA)
grubbs.test(DTA$gvalue2)
# Model fit:
r.squaredGLMM(Jsmr1)
r2beta(Jsmr1, method = "nsj")
epsilon_squared(Jsmr1)
# Run model:
anova(Jsmr1)
# Slopes model
JsmrT1 <- lstrends(Jsmr1, ~ Gtemp2*Gpop2, var="gmass2")
# Run slopes model:
summary(JsmrT1, infer=TRUE)
pairs(JsmrT1 , adjust=c("fdr"))
# Pooled model
Jsmr5 <-lmer(gvalue2 ~ Gtemp2*gmass2 + (1|Gtemp2/Gpop2), na.action=na.exclude, DTA)
# Check for pooled model assumptions:
shapiro.test(resid(Jsmr5))
leveneTest(gvalue2 ~ Gtemp2, DTA)
# Pooled model fit:
r.squaredGLMM(Jsmr5)
# Run pooled model
anova(Jsmr5)
# Pooled slopes model
JsmrT5 <- lstrends(Jsmr5, ~ Gtemp2, var="gmass2")
# Run pooled slopes model
summary(JsmrT5, infer=TRUE)
pairs(JsmrT5 , adjust=c("fdr"))
# Factors
Gpop3 <- factor(DTA$gpop3)
Gtemp3 <- factor(DTA$gtemp3)
# BEST MODEL SELECTION
Jcot1 <-lmer(gvalue3 ~ Gtemp3*Gpop3*gmass3 + (1|Gtemp3/Gpop3), na.action=na.exclude, DTA)
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
Jcot2 <-lmer(gvalue3 ~ Gtemp3*Gpop3*gmass3 + (1|Gpop3), na.action=na.exclude, DTA)
# fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
# check best model using anova
anova(Jcot1,Jcot2)
#Check for assumptions:
shapiro.test(resid(Jcot1))
leveneTest(gvalue3 ~ interaction(Gpop3,Gtemp3), DTA)
grubbs.test(DTA$gvalue3)
# Model fit:
r.squaredGLMM(Jcot1)
r2beta(Jcot1, method = "nsj")
epsilon_squared(Jcot1)
# Run model:
anova(Jcot1)
# Slopes model
JcotT1 <- lstrends(Jcot1, ~ Gtemp3*Gpop3, var="gmass3")
# Run slopes model:
summary(JcotT1, infer=TRUE)
pairs(JcotT1 , adjust=c("fdr"))
# Pooled model
Jcot5 <-lmer(gvalue3 ~ Gtemp3*gmass3 + (1|Gtemp3/Gpop3), na.action=na.exclude, DTA)
Jcot5 <-lmer(gvalue3^-1 ~ Gtemp3*gmass3 + (1|Gtemp3/Gpop3), na.action=na.exclude, DTA)
# Check for pooled model assumptions:
shapiro.test(resid(Jcot5))
leveneTest(gvalue3^-1 ~ Gtemp3, DTA)
# Pooled model fit:
r.squaredGLMM(Jcot5)
# Run pooled model
anova(Jcot5)
# Pooled slopes model
JcotT9 <- lstrends(Jcot5, ~ Gtemp3, var="gmass3")
# Run pooled slopes model
summary(JcotT9, infer=TRUE)
pairs(JcotT9 , adjust=c("fdr"))
library(lme4)
library(multcomp)
library(languageR)
library(LMERConvenienceFunctions)
library(emmeans)
library(MuMIn)
library(EnvStats)
library(broom.mixed)
library(lmerTest)
library(car)
library(outliers)
library(effectsize)
library(rcompanion)
library(MASS)
library(r2glmm)
library(pracma)
DTA <- read.csv(choose.files()) #Select the file named ‘Ghanam_scaled_MO2_data.csv’
names(DTA)
# Subset data for MO2 examinations and Swimming examinations
DTAMO2 <- DTA[c(1:164),c(1:7)]
DTASwim <- DTA[c(165:287),c(1:7)]
# Check that all required rows are included
options(max.print = .Machine$integer.max)
DTAMO2
DTASwim
# Set factors and parameters
GTempF2 <- factor(DTASwim$Temp)
GAreaF2 <- factor(DTASwim$Area)
GMetricF2 <- factor(DTASwim$Metric)
# Select the best model
JJ3 <-lmer(Value ~ GTempF2*GMetricF2*GAreaF2 + (1|ID:GTempF2), na.action=na.exclude, DTASwim)
# fixed-effect model matrix is rank deficient so dropping 3 columns / coefficients
JJ4 <-lmer(Value ~ GTempF2*GMetricF2*GAreaF2 + (1|ID), na.action=na.exclude, DTASwim)
# fixed-effect model matrix is rank deficient so dropping 3 columns / coefficients
# test the models using anova
anova(JJ3,JJ4)
# CHECK ASSUMPTIONS FOR EACH METRIC WITHIN BEST MODEL:
UC<-DTASwim[DTASwim[,"Metric"]=="scaled_Ucrit",]
UB<-DTASwim[DTASwim[,"Metric"]=="scaled_Uburst",]
UO<-DTASwim[DTASwim[,"Metric"]=="scaled_Uopt_cms",]
# Ucrit
UCAreaF <- factor(UC$Area)
UCTempF <- factor(UC$Temp)
JJUC<-lmer(Value ~ UCTempF*UCAreaF + (1|UCTempF), na.action=na.exclude, UC)
anova(JJUC)
shapiro.test(resid(JJUC))
#	Shapiro-Wilk normality test
# data:  resid(JJUC)
# W = 0.97403, p-value = 0.4779
leveneTest(Value ~ interaction(UCTempF,UCAreaF), UC)
# Levene's Test for Homogeneity of Variance (center = median)
# Df F value Pr(>F)
# group  4  2.0469 0.1091
# 35
grubbs.test(UC$Value)
# Uburst
UBAreaF <- factor(UB$Area)
UBTempF <- factor(UB$Temp)
JJUB<-lmer(Value ~ UBTempF*UBAreaF + (1|UBTempF), na.action=na.exclude, UB)
anova(JJUB)
shapiro.test(resid(JJUB))
#	Shapiro-Wilk normality test
# data:  resid(JJUB)
# W = 0.98526, p-value = 0.8803
leveneTest(Value ~ interaction(UBTempF,UBAreaF), UB)
# Levene's Test for Homogeneity of Variance (center = median)
# Df F value Pr(>F)
# group  4  1.6905 0.1749
# 34
grubbs.test(UB$Value)
# Uopt
UOAreaF <- factor(UO$Area)
UOTempF <- factor(UO$Temp)
JJUO<-lmer(Value ~ UOTempF*UOAreaF + (1|UOTempF), na.action=na.exclude, UO)
anova(JJUO)
shapiro.test(resid(JJUO))
#	Shapiro-Wilk normality test
# data:  resid(JJUO)
# W = 0.94329, p-value = 0.04892
leveneTest(Value~ interaction(UOTempF,UOAreaF), UO)
# Levene's Test for Homogeneity of Variance (center = median)
# Df F value Pr(>F)
# group  4  1.0824 0.3806
# 34
grubbs.test(UO$Value)
JJ4 <-lmer(Value^0.98 ~ GTempF2*GMetricF2*GAreaF2 + (1|ID), na.action=na.exclude, DTASwim)
JJUC<-lmer(Value^0.98 ~ UCTempF*UCAreaF + (1|UCTempF), na.action=na.exclude, UC)
anova(JJUC)
shapiro.test(resid(JJUC))
#	Shapiro-Wilk normality test
# data:  resid(JJUC)
# W = 0.97452, p-value = 0.4939
leveneTest(Value^0.98 ~ interaction(UCTempF,UCAreaF), UC)
# Levene's Test for Homogeneity of Variance (center = median)
# Df F value Pr(>F)
# group  4  2.0267  0.112
# 35
grubbs.test(UC$Value^0.98)
# Uburst
JJUB<-lmer(Value^0.98 ~ UBTempF*UBAreaF + (1|UBTempF), na.action=na.exclude, UB)
anova(JJUB)
shapiro.test(resid(JJUB))
#	Shapiro-Wilk normality test
# data:  resid(JJUB)
# W = 0.98496, p-value = 0.8716
leveneTest(Value^0.98 ~ interaction(UBTempF,UBAreaF), UB)
# Levene's Test for Homogeneity of Variance (center = median)
# Df F value Pr(>F)
# group  4  1.6758 0.1783
# 34
grubbs.test(UB$Value^0.98)
# Uopt
JJUO<-lmer(Value^0.98 ~ UOTempF*UOAreaF + (1|UOTempF), na.action=na.exclude, UO)
anova(JJUO)
shapiro.test(resid(JJUO))
#	Shapiro-Wilk normality test
# data:  resid(JJUO)
# W = 0.94395, p-value = 0.05149
leveneTest(Value^0.98~ interaction(UOTempF,UOAreaF), UO)
# Levene's Test for Homogeneity of Variance (center = median)
# Df F value Pr(>F)
# group  4  1.0946 0.3749
# 34
grubbs.test(UO$Value^0.98)
r.squaredGLMM(JJ4)
# Partial SSs (i.e. variance explained by each fixed and random effects)
r.squaredGLMM(JJ4)
r2beta(JJ4, method = "nsj")
epsilon_squared(JJ4)
anova(JJ4)
summary(JJ4)
# PLANNED COMPARISONS:
# note only planned comparisons are shown below, not all possible comparisons.
emmeans(JJ4, pairwise ~ GTempF2*GMetricF2, adjust=c("none"))
